package com.ruoyi.bl.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.bl.mapper.BlGoodsMapper;
import com.ruoyi.bl.domain.BlGoods;
import com.ruoyi.bl.service.IBlGoodsService;

/**
 * 商品信息Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-08-10
 */
@Service
public class BlGoodsServiceImpl implements IBlGoodsService
{
    @Autowired
    private BlGoodsMapper blGoodsMapper;

    /**
     * 查询商品信息
     * 
     * @param goodsId 商品信息主键
     * @return 商品信息
     */
    @Override
    public BlGoods selectBlGoodsByGoodsId(Long goodsId)
    {
        return blGoodsMapper.selectBlGoodsByGoodsId(goodsId);
    }

    /**
     * 查询商品信息列表
     * 
     * @param blGoods 商品信息
     * @return 商品信息
     */
    @Override
    public List<BlGoods> selectBlGoodsList(BlGoods blGoods)
    {
        return blGoodsMapper.selectBlGoodsList(blGoods);
    }

    /**
     * 新增商品信息
     * 
     * @param blGoods 商品信息
     * @return 结果
     */
    @Override
    public int insertBlGoods(BlGoods blGoods)
    {
        blGoods.setCreateTime(DateUtils.getNowDate());
        return blGoodsMapper.insertBlGoods(blGoods);
    }

    /**
     * 修改商品信息
     * 
     * @param blGoods 商品信息
     * @return 结果
     */
    @Override
    public int updateBlGoods(BlGoods blGoods)
    {
        blGoods.setUpdateTime(DateUtils.getNowDate());
        return blGoodsMapper.updateBlGoods(blGoods);
    }

    /**
     * 批量删除商品信息
     * 
     * @param goodsIds 需要删除的商品信息主键
     * @return 结果
     */
    @Override
    public int deleteBlGoodsByGoodsIds(Long[] goodsIds)
    {
        return blGoodsMapper.deleteBlGoodsByGoodsIds(goodsIds);
    }

    /**
     * 删除商品信息信息
     * 
     * @param goodsId 商品信息主键
     * @return 结果
     */
    @Override
    public int deleteBlGoodsByGoodsId(Long goodsId)
    {
        return blGoodsMapper.deleteBlGoodsByGoodsId(goodsId);
    }

    @Override
    public BlGoods findBlGoodsByGoodsSn(String goodsSn) {
        return blGoodsMapper.findBlGoodsByGoodsSn(goodsSn);
    }

    @Override
    public BlGoods findBlGoodsByNextGoodsSn() {
        return blGoodsMapper.findBlGoodsByNextGoodsSn();
    }
}
